''' Mission 9 Remix 1A Add an introduction and ending message Use buttons to "wait" to start and end game ''' from codex import * import random from time import sleep def intro(): display.print("Game Spinner") display.print("Press A/B to spin") display.print() display.print("Press U to start") display.print("Press D to stop") while True: if buttons.was_pressed(BTN_U): break def show_random_arrow(): arrow = random.randrange(8) display.show(pics.ALL_ARROWS[arrow]) def spin_animation(count): index = 0 loops = 0 delay = 0.0 while loops < count: loops = loops + 1 display.show(pics.ALL_ARROWS[index]) sleep(delay) delay = delay + 0.005 index = index + 1 if index == 8: index = 0 # Main Program intro() while True: if buttons.is_pressed(BTN_A) or buttons.is_pressed(BTN_B): spin_animation(20) show_random_arrow() if buttons.is_pressed(BTN_D): break display.clear() display.print("Thanks",scale=4)